<?php

namespace app\api\model\house;

use think\Model;


class HouseLevel extends Model
{

    

    

    // 表名
    protected $name = 'house_level';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'level_text',
    ];






    public function getLevelList()
    {
        return [1=>'家家普选',2=>'家家惠选',3=>'家家乐选',4=>'家家优选',5=>'家家尊选'];

    }

    public function getLevelTextAttr($value, $data)
    {
        $value = $value ?: ($data['level'] ?? '');

        $list = $this->getLevelList();
        return $list[$value] ?? '';
    }




}
